import Vue from 'vue'
import VueRouter from 'vue-router'

const Home = () => import('@/views/home/home');
const Login = () => import('@/views/login/login');
const Register = () => import('@/views/register/register');
const Profile = () => import('@/views/profile/profile');
const Content = () => import('@/views/home/content/content');
const Detail = () => import('@/views/home/content/detail')



Vue.use(VueRouter)

const routes = [{
		path: '/',
		component: Home,
		children: [{
				path: "/",
				component: Content
			}, //定义子路由默认显示的路由
			{
				path: "/detail/:id", //使用动态路由去获取文章的id
				component: Detail
			}
		]
	},
	{
		path: '/login',
		name: 'Login',
		component: Login
	},
	{
		path: '/register',
		name: 'Register',
		component: Register
	},
	{
		path: '/profile',
		name: 'Profile',
		component: Profile
	}
]

const router = new VueRouter({
	routes
})

export default router
